package com.ydd.controller.admin;

import com.ydd.dto.UserDTO;
import com.ydd.result.Result;
import com.ydd.service.ISysUserService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/sys_user")
@Api("管理员管理")
public class SysUserController {

    @Autowired
    private ISysUserService userService;

    @GetMapping("/list")
    public Result UserList(UserDTO dto) {
        return userService.UserList(dto);
    }

    @GetMapping("/del")
    public Result delUser(String id) {
        return userService.delUser(id);
    }

    @PostMapping("/add")
    public Result addUser(@RequestBody UserDTO dto) {
        return userService.addUser(dto);
    }

    @GetMapping("/rowInfo")
    public Result rowInfo(String id) {
        return userService.rowInfo(id);
    }

    @PostMapping("/update")
    public Result update(@RequestBody UserDTO dto) {
        return userService.updateUser(dto);
    }
}
